/*package cn.wx.scholar.es.service;

import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.csvreader.CsvReader;
import cn.wx.common.utils.UUIDGenerator;
import cn.wx.scholar.es.entity.EsOrg;
import cn.wx.scholar.es.repository.EsOrgRepository;

*//**
 * 全文检索
 * @author Administrator
 *//*
@Service
@Transactional
public class EsOrgService {
	
	@Autowired
	private EsOrgRepository esOrgRepository;
	
	
	
	public String create() {
		final String filePath = "E:\\my_read_csv\\ms_orgnization.csv";
		try {
			
			CsvReader csvReader = new CsvReader(filePath);
			
			// 读表头
            csvReader.readHeaders();
            
            List<EsOrg> els = new ArrayList<>();
            EsOrg el = null;
            int i = 0;
            while (csvReader.readRecord()){
                // 读一整行
            	String line = csvReader.getRawRecord();
				if(StringUtils.isBlank(line)) {
					continue;
				}

				String fId = csvReader.get(0);
				String eName = csvReader.get(1);
				
				el = new EsOrg();
				el.setId(UUIDGenerator.getUUID());
				el.setfId(Long.parseLong(fId));
				el.seteName(eName);
				els.add(el);
				
				if(els.size() > 499) {
					i++;
					createBatch(els);
					els.clear();
					System.out.println("执行" + i +"次插入。");
				}
				
            }

            *//**
			 * 关闭读入流
			 *//*
			csvReader.close();
			csvReader = null;
            
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "succ";
	}
	
	*//**
	 * 批量插入
	 * @param efts
	 *//*
	public void createBatch(List<EsOrg> efts) {
		esOrgRepository.saveAll(efts);
	}
	
}
*/